<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第二个</title>
    <style>
        .box {
            width: 250px;
            height: 250px;
            margin: 200px auto;
            background-color: black;
            line-height: 250px;
            text-align: center;
            cursor: pointer;
            padding-bottom: 56px;
        }

        .box h2 {
            color: aliceblue;

        }
        body {
			color: #fff;
			font: 12px/1.5 Tahoma;
		}

		#div1 {
			width: 150px;
			height: 150px;
			margin: 0 auto;
			padding: 10px;
			background: black;
			border: 10px solid #000;
			cursor: crosshair;
            margin-top: 80px;
		}

		#div1.hover {
			color: white;
			background: #8fbff5;
			border: 10px solid ;
		}
    </style>
    <script type="text/javascript">
       window.onload = function () {
			var oDiv = document.getElementById("div1");
			oDiv.onmouseover = function () {
				oDiv.className = "hover"
			};
			oDiv.onmouseout = function () {
				oDiv.className = ""
			}
		};
    </script>
</head>


<body>
    <div class="box">
        <div id="div1">鼠标移入改变样式，鼠标移出恢复。</div>
        <h2>请把鼠标移到我身上</h2>
    </div>
</body>


</html>